<template>
	<view>
		<view class="List" v-for="item in dataItem" :key="item.id">
			<view class="iconfont icon-shanchu color_99 size36 a-self-start" @click.stop="delItem(item)"></view>
			<view class="userInfo">

				<view class="Info">
					<image :src="$imgUrls(item.v_headimg)" mode="aspectFill" class="v_headimg"></image>
					<view class="d-flex f-column flex-1">
						<view class="d-flex a-center">
							<text class="black size32 v_name ">{{item.v_name}}</text>
							<view class="vipName">{{item.vipName}}</view>
						</view>
						<text class="color_33 size26 m-top10">{{item.v_addDate}}</text>
					</view>
				</view>
				<view class="disposition" @click.stop="toUrl(`Disposition?id=${item.id}`)">
					<text class="iconfont icon-peizhiguanli color size40"></text>
					<text class="color size26 m-top8">配置收益</text>
				</view>
			</view>


			<view class="dataInfo">
				<view class="dataLi">
					<text class="black size36">{{item.userNum}}</text>
					<text class="color_33 size26 m-top4">直属客户</text>
				</view>
				<view class="dataLi">
					<text class="black size36">{{item.orderNum}}</text>
					<text class="color_33 size26 m-top4">客户订单</text>
				</view>
				<view class="dataLi">
					<text class="black size36">￥{{item.orderMoney}}</text>
					<text class="color_33 size26 m-top4">订单金额</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: ['pageData'],
		data() {
			return {
				dataItem: [],
			}
		},
		methods: {
			async delItem(Item) {
				const Result = await this.$Modal('删除', `确定要删除 "${Item.v_name}" 吗？`)
				if (!Result) return
				this.$http.post({
					url: '/osmxcxApi/delDirectSalesMember',
					data: {
						uid: Item.id
					}
				}).then(res => {
					if (res.code != 100) return
					const Index = this.dataItem.findIndex(n => n.id == Item.id)
					if (Index < 0) return
					this.dataItem.splice(Index, 1)
				})


			}
		},
		watch: {
			pageData: {
				immediate: true,
				handler(newVal) {
					if (newVal) this.dataItem = newVal
				}
			}

		}
	}
</script>

<style lang="scss" scoped>
	.List {
		width: 710rpx;
		background-color: #ffffff;
		border-radius: 10rpx;
		margin: 24rpx auto 0;
		position: relative;

		.icon-shanchu {
			position: absolute;
			top: 0;
			right: 0;
			padding: 14rpx;
		}

		.userInfo {
			width: 100%;
			padding: 30rpx 50rpx 30rpx 24rpx;
			border-bottom: 1rpx solid #f2f2f2;
			display: flex;
			align-items: center;

			.Info {
				flex: 1;
				display: flex;
				align-items: center;

				.v_headimg {
					width: 80rpx;
					height: 80rpx;
					border-radius: 6rpx;
					margin-right: 24rpx;
				}

				.v_name {
					max-width: 320rpx;
					overflow: hidden;
					text-overflow: ellipsis;
					display: -webkit-box;
					-webkit-line-clamp: 1;
					-webkit-box-orient: vertical;
				}

				.vipName {
					padding: 0 10rpx;
					background-color: var(--color);
					color: #fff;
					font-size: 20rpx;
					border-radius: 10rpx;
					margin-left: 16rpx;
				}


			}

			.disposition {
				display: flex;
				flex-direction: column;
				align-items: center;

			}
		}

		.dataInfo {
			width: 100%;
			padding: 20rpx 24rpx;
			display: flex;
			justify-content: space-between;

			.dataLi {
				display: flex;
				flex-direction: column;
				align-items: center;
			}
		}
	}
</style>